<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="600px" @open="open" @close="close">
    <el-form class="tl-form" ref="form" :model="model" :rules="rules" label-width="100px" :disabled="disableEditSubmit">
      <el-row>
        <el-col :span="24">
          <el-form-item label="字段编码" prop="columncode" :rules="rules.validateRequire">
            <el-select v-model="model.columncode" filterable clearable>
              <el-option v-for="item in list" :key="item.code" :label="item.name" :value="item.code" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="字段值" prop="columnvalue" :rules="rules.validateRequire">
            <el-input v-model="model.columnvalue" type="textarea" :rows="4"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button :type="disableEditSubmit === false ? 'text' : 'primary'" @click="doCancelEdit">取消</el-button>
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="disableEditSubmit === false">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
/** 子组件 */
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: {},
  data() {
    return {
      moduleTitle: '流程节点扩展',
      urlPrefix: '/base/tableExtend/',
      url: {
        // 额外的url
      },
      sourceid: '',
      relationid: '',
      list: [{ name: '允许自定义退回', code: 'allowBack' }]
    }
  },
  methods: {
    loaded() {
      // 页面加载完毕执行
      if (this.isAdd) {
        this.$set(this.model, 'sourceid', this.sourceid)
        this.$set(this.model, 'relationid', this.relationid)
        this.$set(this.model, 'sourcetype', 'CboApprovalNode')
      }
    },
    beforeSubmit() {
      this.$set(this.model, 'columnname', this.list.find((m) => m.code === this.model.columncode).name)
      return true
    }
  }
}
</script>
